/* iPhone 15 Dynamic Island & Live Generation Styles */

:root {
    --island-bg: rgba(20, 20, 20, 0.94);
    --island-border: rgba(255, 255, 255, 0.16);
    --island-accent: #007aff;
    --island-text: #ffffff;
    --island-subtext: #8e8e93;
    --island-interrupt: #ff3b30;
    --island-skip: #ff9500;
}

/* ==========================================================
   1. Live Floating Island Pill (Floats above mobile bottom bar)
   ========================================================== */
.forge-live-bottom-pill {
    position: fixed !important;
    bottom: 68px !important; /* Floats right above the 50px mobile action bar */
    left: 12px !important;
    width: calc(100vw - 24px) !important;
    max-width: 500px !important;
    height: 66px !important;
    margin: 0 auto !important;
    background: var(--island-bg) !important;
    border: 1px solid var(--island-border) !important;
    border-radius: 16px !important;
    padding: 8px 12px !important;
    backdrop-filter: blur(25px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8) !important;
    z-index: 9999 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif !important;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.forge-live-bottom-pill.pill-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(12px) scale(0.96) !important;
}

/* Video Thumbnail container */
.forge-live-bottom-pill .pill-video-wrap {
    position: relative !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    background: #1e1e1e !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.forge-live-bottom-pill .pill-preview-fallback {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: none;
}

/* Info and Progress Bar */
.forge-live-bottom-pill .pill-info-col {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    flex-grow: 1 !important;
    overflow: hidden !important;
    min-width: 0 !important;
}

.forge-live-bottom-pill .pill-title-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 2px !important;
}

.forge-live-bottom-pill .pill-title {
    font-size: 12.5px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.forge-live-bottom-pill .pill-percentage {
    font-size: 12.5px !important;
    font-weight: 700 !important;
    color: var(--island-accent) !important;
}

.forge-live-bottom-pill .pill-subtitle {
    font-size: 11px !important;
    color: var(--island-subtext) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.forge-live-bottom-pill .pill-progress-track {
    width: 100% !important;
    height: 4px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border-radius: 2px !important;
    margin-top: 4px !important;
    overflow: hidden !important;
}

.forge-live-bottom-pill .pill-progress-fill {
    height: 100% !important;
    width: 0% !important;
    background: linear-gradient(90deg, #007aff, #5856d6) !important;
    border-radius: 2px !important;
    transition: width 0.2s ease-out !important;
}

.forge-live-bottom-pill .pill-pip-btn {
    border: 1px solid rgba(0, 122, 255, 0.4) !important;
    background: rgba(0, 122, 255, 0.2) !important;
    color: #007aff !important;
    border-radius: 10px !important;
    padding: 6px 9px !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 3px !important;
}

.forge-live-bottom-pill .pill-pip-btn:active {
    transform: scale(0.92) !important;
}

/* ==========================================================
   2. Top Hardware Dynamic Island Notch Overlay
   ========================================================== */
#forge-dynamic-island-container {
    position: fixed;
    top: 11px;
    top: calc(env(safe-area-inset-top, 11px) - 48px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.45s cubic-bezier(0.32, 0.72, 0, 1);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

#forge-dynamic-island {
    position: relative;
    box-sizing: border-box;
    background: var(--island-bg);
    border: 1px solid var(--island-border);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.2);
    color: var(--island-text);
    overflow: hidden;
    pointer-events: auto;
    cursor: pointer;
    transition: width 0.42s cubic-bezier(0.32, 0.72, 0, 1),
                height 0.42s cubic-bezier(0.32, 0.72, 0, 1),
                border-radius 0.42s cubic-bezier(0.32, 0.72, 0, 1),
                transform 0.3s ease,
                opacity 0.3s ease;
}

#forge-dynamic-island.island-compact {
    width: 126px;
    height: 37px;
    border-radius: 19px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
}

#forge-dynamic-island.island-expanded {
    width: 360px;
    max-width: calc(100vw - 24px);
    height: 84px;
    border-radius: 38px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#forge-dynamic-island.island-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.island-compact-indicator {
    font-size: 12px;
    font-weight: 700;
    color: var(--island-accent);
}

.island-compact-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 14px;
}

.island-wave-bar {
    width: 2px;
    height: 100%;
    background-color: #34c759;
    border-radius: 1px;
    animation: islandPulse 1s ease-in-out infinite alternate;
}

.island-wave-bar:nth-child(2) { animation-delay: 0.2s; height: 60%; }
.island-wave-bar:nth-child(3) { animation-delay: 0.4s; height: 80%; }

@keyframes islandPulse {
    0% { transform: scaleY(0.4); }
    100% { transform: scaleY(1.1); }
}

/* Hidden canvas, audio, and offscreen PiP video */
#forge-island-pip-canvas,
#forge-island-silent-audio,
#forge-island-pip-video-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    left: -9999px;
    top: -9999px;
}
